import type { RowData } from 'naive-ui/es/data-table/src/interface';
import type { ComponentOptions, PropType } from 'vue';

import type { BasicTableColumn } from './types/table';

export interface TableFieldProps {
  /**
   * 字段信息
   */
  field: BasicTableColumn;
  /**
   * 行索引
   */
  index: number;
  /**
   * 行数据
   */
  rowData: RowData;
}

export const BaseTableField: ComponentOptions<TableFieldProps> = {
  props: {
    field: {
      type: Object as PropType<BasicTableColumn>,
      required: true,
    },
    index: {
      type: Number,
      required: true,
    },
    rowData: {
      type: Object as PropType<RowData>,
      required: true,
    },
  },
};
